home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / laptop-mode-tools / modules / syslog-conf < prev    next >
Text File  |  2009-10-06  |  2KB  |  56 lines

  1. #! /bin/sh
  2. #
  3. # Laptop mode tools module: syslog.conf switching functionality (DEPRECATED)
  4. #
  5. #
  6. # This module implements the old syslog.conf functionality -- deprecated but
  7. # still supported for backward compatibility.
  8.  
  9.  
  10.  
  11. if [ x$CONTROL_SYSLOG_CONF = x1 ] ; then
  12.     $LM_VERBOSE && echo "Adjusting syslog configuration." >> $OUTPUT
  13.     if [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
  14.         echo "$SYSLOG_CONF is a symlink." >> $OUTPUT
  15.         if [ ! -f "$SYSLOG_CONF.no-lm" ] ; then
  16.             $LM_VERBOSE && echo "But there is no $SYSLOG_CONF.no-lm. This must have been done by an earlier" >> $OUTPUT
  17.             $LM_VERBOSE && echo "version of laptop-mode-tools." >> $OUTPUT
  18.             $LM_VERBOSE && echo "Creating it now from $NOLM_AC_SYSLOG_CONF." >> $OUTPUT
  19.             cp "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
  20.         fi
  21.     else
  22.         $LM_VERBOSE && echo "$SYSLOG_CONF is not a symlink." >> $OUTPUT
  23.         if [ "$STATE" = "enabled" ] ; then
  24.             $LM_VERBOSE && echo "Saving it to $SYSLOG_CONF.no-lm." >> $OUTPUT
  25.             cp --backup=numbered "$SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
  26.         fi
  27.     fi
  28.  
  29.     if [ "$STATE" != "enabled" ] ; then
  30.         $LM_VERBOSE && echo "Laptop mode is not enabled. Restoring $SYSLOG_CONF." >> $OUTPUT
  31.         if [ -f "$SYSLOG_CONF.no-lm" ] ; then
  32.             mv "$SYSLOG_CONF.no-lm" "$SYSLOG_CONF"
  33.         elif [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
  34.             echo "ERROR: $SYSLOG_CONF is a symlink but $SYSLOG_CONF.no-lm is not present."
  35.         fi
  36.     elif [ $ON_AC -eq 1 ] ; then
  37.         if [ "$ACTIVATE" -eq 1 ] ; then
  38.             $LM_VERBOSE && echo "Setting syslog config to $LM_AC_SYSLOG_CONF." >> $OUTPUT
  39.             ln -fs "$LM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
  40.         else
  41.             $LM_VERBOSE && echo "Setting syslog config to $NOLM_AC_SYSLOG_CONF." >> $OUTPUT
  42.             ln -fs "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
  43.         fi
  44.     else
  45.         $LM_VERBOSE && echo "Setting syslog config to $BATT_SYSLOG_CONF." >> $OUTPUT
  46.         ln -fs "$BATT_SYSLOG_CONF" "$SYSLOG_CONF"
  47.     fi
  48.     # Notify syslogd of configuration change.
  49.     if [ "$SYSLOG_CONF_SIGNAL_PROGRAM" != "" ] ; then
  50.         $LM_VERBOSE && echo "Sending SIGHUP to all $SYSLOG_CONF_SIGNAL_PROGRAM processes." >> $OUTPUT
  51.         killall -q -HUP $SYSLOG_CONF_SIGNAL_PROGRAM
  52.     fi
  53. fi
  54.  
  55.